package DataAccess;

/** 
 Data Access Layer Object Collection Of QiShu
*/
public class QiShuCollection extends DataAccessCollectionBase
{
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ����ͻ���
	public QiShuCollection()
	{
		super();
	}
	@Override
	protected DataTable BuildTable()
	{
		DataTable dt = new DataTable();
		dt.Columns.Add("Id",Integer.class);
		dt.Columns.Add("CaiZhong_Id",Integer.class);
		dt.Columns.Add("QiHao",String.class);
		dt.Columns.Add("Exp_Upload",java.time.LocalDateTime.class);
		dt.Columns.Add("Exp_Buy",java.time.LocalDateTime.class);
		dt.Columns.Add("addTime",java.time.LocalDateTime.class);
		dt.Columns.Add("kaijTime",java.time.LocalDateTime.class);
		dt.Columns.Add("kaij",String.class);
		dt.Columns.Add("kaijDetail",String.class);
		dt.Columns.Add("Qihao_1",Integer.class);
		dt.Columns.Add("Qihao_2",Integer.class);
		dt.Columns.Add("Zt",String.class);
		dt.Columns.Add("beizhu",String.class);
		return dt;
	}
	@Override
	protected DataAccessBase GetItemByIndex(int index)
	{
		return new QiShu(_DataTable.Rows[index]);
	}
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ����ͻ���
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ����
	public final DataTable getTable()
	{
		return super._DataTable;
	}
	public final QiShu getItem(int index)
	{
		return new QiShu(_DataTable.Rows[index]);
	}
	public final void setItem(int index, QiShu value)
	{
		_DataTable.Rows.RemoveAt(index);
		_DataTable.Rows.InsertAt(value.getDataRow(),index);
	}
	public enum Field
	{
		Id,
		CaiZhong_Id,
		QiHao,
		Exp_Upload,
		Exp_Buy,
		addTime,
		kaijTime,
		kaij,
		kaijDetail,
		Qihao_1,
		Qihao_2,
		Zt,
		beizhu;

		public int getValue()
		{
			return this.ordinal();
		}

		public static Field forValue(int value)
		{
			return values()[value];
		}
	}
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ����
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ��������
	protected final boolean ListByCondition(String condition)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"					Id," + "\r\n" +
"					CaiZhong_Id," + "\r\n" +
"					QiHao," + "\r\n" +
"					Exp_Upload," + "\r\n" +
"					Exp_Buy," + "\r\n" +
"					addTime," + "\r\n" +
"					kaijTime," + "\r\n" +
"					kaij," + "\r\n" +
"					kaijDetail," + "\r\n" +
"					Qihao_1," + "\r\n" +
"					Qihao_2," + "\r\n" +
"					Zt," + "\r\n" +
"					beizhu" + "\r\n" +
"				  From QiShu" + "\r\n" +
"				 Where " + condition + "\r\n" +
"			";
		return super.ListBySql(sql);
	}

	public final boolean ListAll()
	{
		String condition = "1=1";
		return ListByCondition(condition);
	}
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ��������
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ���淽��
	public final boolean ListByCzid(int CaizhongId)
	{
		String condition = "";
		if (CaizhongId != 0)
		{
			condition = "1=1 And CaiZhong_id = " + String.valueOf(CaizhongId) + " And kaij = '' order by id asc";

		}
		if (CaizhongId == 0)
		{
			condition = "1=1  And kaij = '' order by id asc";
			return ListByCondition(condition);
		}
		return ListByCondition(condition);
	}
	//�г��ѿ��������� �����޸�
	public final boolean ListByCzidByikaijiang(int CaizhongId)
	{
		String condition = "";
		if (CaizhongId != 0)
		{
			condition = " CaiZhong_id = " + String.valueOf(CaizhongId) + " And kaij <> '' and caizhong_id2 = " + CaizhongId + " order by qihao desc";
		}
		if (CaizhongId == 0)
		{
			condition = " kaij <> '' order by qihao desc";
			return ListByCondition(condition);
		}
		return ListByCondition(condition);

	}
	//�����ں��Լ�Caizhongid ��ѯ�ѿ���������
	public final boolean ListByCzidByikaijiangByQihao(int CaizhongId, String Qihao)
	{
		String condition = "";
		if (CaizhongId != 0)
		{
			condition = " CaiZhong_id = " + String.valueOf(CaizhongId) + " And kaij <> '' and caizhong_id2 =" + CaizhongId + " And QiHao = " + Helper.ToSQLParamStr(Qihao);
		}
		if (CaizhongId == 0)
		{
			condition = " kaij <> '' And QiHao = " + Helper.ToSQLParamStr(Qihao);
			return ListByCondition(condition);
		}
		return ListByCondition(condition);
	}


	//��������ģ����ѯĳһ��ļ�¼ 
	public final boolean ListByCzidByikaijiangByQihaoLike(int CaizhongId, String Qihao)
	{
		String condition = "";
		if (CaizhongId != 0)
		{
			condition = " CaiZhong_id = " + String.valueOf(CaizhongId) + " And kaij <> '' and caizhong_id2 = " + CaizhongId + " And qihao_1 like '%" + Helper.QuotedStr(Qihao) + "%'";
		}
		if (CaizhongId == 0)
		{
			condition = " kaij <> '' And qihao_1 like '%" + Helper.QuotedStr(Qihao) + "%'";
			return ListByCondition(condition);
		}
		return ListByCondition(condition);

	}
	public final boolean ListTopX(int X)
	{
		String sql = "" + "\r\n" +
"					Select" + "\r\n" +
"					top " + String.valueOf(X) + " *" + "\r\n" +
"					From QiShu" + "\r\n" +
"					Where 1=1" + "\r\n" +
"				   And kaij <> '' order by kaijTime desc" + "\r\n" +
"			";
		return super.ListBySql(sql);
	}


	public final boolean ListByQihao1(String Qihao1)
	{
		String condition = "1=1 And qihao_1 = " + Helper.ToSQLParamStr(Qihao1);
		condition += " order by kaijTime desc";
		return ListByCondition(condition);

	}

	public final boolean ListByQihao(String Qihao)
	{
		String condition = "1=1 And kaij = '' and qihao =" + Helper.ToSQLParamStr(Qihao);

		return ListByCondition(condition);

	}



//		public bool ListByCzid(int CaizhongId)
//		{
//			string condition = string.Empty;
//			if(CaizhongId !=0)
//			{
//				condition = @"1=1 And CaiZhong_id = "
//					+CaizhongId.ToString()+@" And kaij = '' order by qihao asc";
//			
//			}
//			if(CaizhongId== 0)
//			{
//				condition = @"1=1  And kaij = '' order by qihao asc";
//				return ListByCondition(condition);
//			}
//			return ListByCondition(condition);
//		}
	//�г��ѿ��������� �����޸�
//		public bool ListByCzidByikaijiang(int CaizhongId)
//		{
//			string condition = string.Empty;
//			if(CaizhongId !=0)
//			{
//				condition = @" CaiZhong_id = "
//					+CaizhongId.ToString()+@" And kaij <> '' and caizhong_id2 = "+CaizhongId+" order by qihao desc";
//			}
//			if(CaizhongId ==0)
//			{
//				condition = @" kaij <> '' order by qihao desc";
//				return ListByCondition(condition);
//			}
//			return ListByCondition(condition);
//		
//		}
//		//�����ں��Լ�Caizhongid ��ѯ�ѿ���������
//		public bool ListByCzidByikaijiangByQihao(int CaizhongId,string Qihao)
//		{
//			string condition = string.Empty;
//			if(CaizhongId !=0)
//			{
//				condition= @" CaiZhong_id = "
//					+CaizhongId.ToString()+@" And kaij <> '' and caizhong_id2 ="+CaizhongId+" And QiHao = "+Helper.ToSQLParamStr(Qihao);
//			}
//			if(CaizhongId == 0)
//			{
//				condition= @" kaij <> '' And QiHao = "+Helper.ToSQLParamStr(Qihao);
//				return ListByCondition(condition);
//			}
//			return ListByCondition(condition);
//		}
//		
//		
//		//��������ģ����ѯĳһ��ļ�¼ 
//		public bool ListByCzidByikaijiangByQihaoLike(int CaizhongId,string Qihao)
//		{
//			string condition = string.Empty;
//			if(CaizhongId != 0)
//			{
//				condition = @" CaiZhong_id = "
//					+CaizhongId.ToString()+@" And kaij <> '' and caizhong_id2 = "+CaizhongId+" And qihao_1 like '%"+Helper.QuotedStr(Qihao)+"%'";
//			}
//			if(CaizhongId ==0)
//			{
//				condition = @" kaij <> '' And qihao_1 like '%"+Helper.QuotedStr(Qihao)+"%'";
//				return ListByCondition(condition);
//			}
//			return ListByCondition(condition);
//		
//		}
//		public bool ListTopX(int X)
//		{
//			string sql = @"
//					Select
//					top "+X.ToString()+ @" *
//					From QiShu
//					Where 1=1
//				   And kaij <> '' order by kaijTime desc
//			";
//			return base.ListBySql(sql);
//		}
//
//
//		public bool ListByQihao1(string Qihao1)
//		{
//			string condition = @"1=1 And qihao_1 = "
//				+ Helper.ToSQLParamStr(Qihao1);
//			condition += " order by kaijTime desc";
//			return ListByCondition(condition);
//		
//		}
//
//		public bool ListByQihao(string Qihao)
//		{
//			string condition = @"1=1 And kaij = '' and qihao ="+ Helper.ToSQLParamStr(Qihao);
//		
//			return ListByCondition(condition);
//		
//		}


//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ���淽��
}